﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Security.Cryptography;
using System.Text;
namespace BookStore.Common
{
   public class encryption
    {
       public static string toMD5(string pass)
       {
           MD5CryptoServiceProvider myMD5 = new MD5CryptoServiceProvider();
           byte[] myPass = System.Text.Encoding.UTF8.GetBytes(pass);
           myPass = myMD5.ComputeHash(myPass);

           StringBuilder s = new StringBuilder();
           foreach (byte p in myPass)
           {
               s.Append(p.ToString("x").ToLower());
           }
           return s.ToString();
       }
    }
}
